package org.swingDemo.UI.panel;

import net.miginfocom.swing.MigLayout;
import org.swingDemo.util.UIUtil;

import javax.swing.*;
import java.io.File;

public class FolderPathPanel extends JPanel {

    private JTextField folderPathTextField;

    public FolderPathPanel() {
        initPanel();
    }

    private void initPanel() {
        folderPathTextField = UIUtil.createTextField("", false);

        this.setLayout(new MigLayout("fill", "[fill]"));
        this.add(folderPathTextField, "push");
    }

    public void updateFolderPath(File folder) {
        folderPathTextField.setText(folder.getAbsolutePath());
    }

    public String getFolderPath() {
        return folderPathTextField.getText();
    }
}
